﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using leviathan.supervisor;

namespace leviathan_rpg
{
    public partial class characterLoad : Form
    {
        Supervisor Felugyelo;

        public characterLoad(Supervisor supv)
        {
            InitializeComponent();
            Felugyelo = supv;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string str = comboBox1.Text;
            if ("" == str)
            {
                MessageBox.Show("Hibás Karakternév", "Hiba!");
                return;
            }
            Felugyelo.loadCharacter(str);

            this.SendToBack();
            this.Close();
        }

        private void characterLoad_Load(object sender, EventArgs e)
        {
            using(StreamReader sr = new StreamReader("../../saves/SaveList.lst"))
            {
                while (!sr.EndOfStream)
                {
                    comboBox1.Items.Add(sr.ReadLine());
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
